# -*- coding: utf-8 -*-

import re

'''
@Time    : 2021/11/9 9:32
@Author  : 羊二狗
@FileName: test.py
@Software: PyCharm
 
'''


# 这种合并方式主要用于将数据表的字段与记录值合并成一个字典，
# 一般会返回给客户端以便进行其他处理
def aa():
    a = ['a', 'b']
    b = [1, 2]

    print(dict(zip(a, b)))

    fields = ('id', 'name', 'age')
    #records = [['01', 'Bill', '20'], ['02', 'Mike', '30']]
    records = [(1, 'Bill', '20')]

    result =[]
    for record in records:
        result.append(dict(zip(fields, record)))

    print(result)


def compare_items(result):
    # caution: if v is NULL, may need to process
    (k, v) = result
    if v is None:
        return '`%s` IS %%s' % k
    else:
        return '`%s`=%%s' % k

if __name__ == '__main__':
    aa()
    # str1="INSERT INTO `yanghua0`.`sys_dictionary`(`did`, `dname`, `dvalue`, `type`) VALUES (1456185142124072965, '小李飞刀', 100025, 'COUNTY_CODE')"
    #
    # result_list = re.findall(r'[(](.*?)[)]', str1)
    #
    # print(result_list[0])